<template>
  <el-menu 
  v-model="isCollapse" 
  router
  default-active="2" 
  class="el-menu-vertical-demo"
   @open="handleOpen" 
   @close="handleClose"
    background-color="#2d3436" text-color="#fff" active-text-color="#ffd04b">
    <div class="introduction">
      <div class="avatar">
        <img src="../assets/avatar.jpg" alt="" style="cursor:pointer" width="100%" height="100%" @click="goMinePage" />
      </div>
      <p class="nickname">BladeK</p>

      <!-- //对人生的剧透 像“死亡”一样呐 -->
      <p class="sign">神っぽいな</p>
    </div>
    </el-submenu>
    <el-menu-item index="/index">
      <i class="el-icon-menu"></i>
      <span slot="title">博客首页</span>
    </el-menu-item>
    <el-menu-item index="3" disabled>
      <i class="el-icon-document"></i>
      <span slot="title">导航三</span>
    </el-menu-item>
    <el-menu-item index="4">
      <i class="el-icon-setting"></i>
      <span slot="title">导航四</span>
    </el-menu-item>
    <div class="menu-row">
      <div class="module">
        <i class="el-icon-setting"></i>
        <p>进入后台</p>
      </div>
      <div class="module pad-write-line">
        <i class="el-icon-edit-outline"></i>
        <p>发表评论</p>
      </div>
    </div>
  </el-menu>
</template>

<script>
export default {
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    goMinePage() {
      this.$router.push("mine");
    },
  },
};
</script>

<style lang="less" scoped>
.el-menu-vertical-demo {
  height: 100%;
  width: 100%;
  position: relative;
  border-right: 0;
  .introduction {
    height: 25%;
    width: 100%;
    padding: 10px;
    display: flex;
    font-family: "微软雅黑";
    flex-direction: column;
    justify-content: center;
    align-items: center;
    .avatar {
      width: 100px;
      height: 100px;
      border-radius: 50%;
      background-color: #fff;
      margin-bottom: 10px;
      img {
        width: 100px;
        height: 100px;
        border-radius: 50%;
      }
    }
    .nickname {
      font-size: 18px;
    }
    .sign {
      font-size: 14px;
    }
    p {
      text-align: center;
      color: #fff;
      line-height: 30px;
    }
  }
  .menu-row {
    display: flex;
    position: absolute;
    width: 100%;
    bottom: 1px; //未知bug，
    left: 0;
    background-color: #15181a;
    .module {
      width: 50%;
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      padding: 5px;
      &:hover {
        cursor: pointer;
        background: #363d42;
      }
      i {
        color: #fff;
        font-size: 24px;
        margin-bottom: 5px;
      }
      p {
        font-size: 14px;
        color: #fff;
      }
    }
  }
}
</style>
